import { ApiCall } from "tsrpc";
import { ReqGetMails, ResGetMails } from "../../../shared/protocols/masterServer/mail/PtlGetMails";
import { DBMail } from "../../DBMail";
import { MasterServerConn } from "../../MasterServer";

export async function ApiGetMails(call: ApiCall<ReqGetMails, ResGetMails>) {
    let req = call.req;
    let info = (call.conn as MasterServerConn).userInfo;
    let mails = DBMail.getMailsByUid(info.uid!);
    call.succ({mails:mails});
}